<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .box {
        overflow: hidden;
        width: 400px;
        height: 400px;
      }
    </style>
  </head>
  <body>
    <div class="box">
      <img src="1.jpg" alt="" width="400px" />
    </div>
    <script src="jquery/jquery-3.6.1.js"></script>

    <script>
      let img = $("img");

      //   img.on("mouseover", () => {
      //     img.css("width", "500px");
      //   });

      //   img.on("mouseout", () => {
      //     img.css("width", "400px");
      //   });

      img.hover(
        () => {
          console.log("鼠标在上面");
        },
        function () {
          console.log("鼠标移走了");
        }
      );
    </script>
  </body>
</html>
